package com.carkeeper.caruser.service.impl;

import com.carkeeper.caruser.dao.CarMapper;
import com.carkeeper.caruser.pojo.Car;
import com.carkeeper.caruser.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.math.BigInteger;
import java.util.List;

@Service
public class CarServiceImpl implements CarService {

    @Autowired
    private CarMapper carMapper;

    /**
     * 查询车主车辆信息
     * @param userId
     * @return
     */
    @Override
    public List<Car> findCarByUserId(BigInteger userId) {

        Example example=new Example(Car.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userId", userId);
        List<Car> cars = carMapper.selectByExample(example);
        return cars;
    }
}
